export default class api_chagnescreen {
	public static changeCanvasToHorizontal() {
		if (cc.sys.isNative) {
			if (cc.sys.os == cc.sys.OS_ANDROID) {
				jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "changeOrientationH", "(I)V", 1);
				cc.view.setOrientation(cc.macro.ORIENTATION_LANDSCAPE)
				cc.director.getScene().children[0].getComponent(cc.Canvas).designResolution = cc.size(1334, 750)
				cc.director.getScene().children[0].getComponent(cc.Canvas).fitHeight = true
				cc.director.getScene().children[0].getComponent(cc.Canvas).fitWidth = false
			}
			if (cc.sys.os == cc.sys.OS_IOS) {
				cc.view.setOrientation(cc.macro.ORIENTATION_LANDSCAPE)
				cc.director.getScene().children[0].getComponent(cc.Canvas).designResolution = cc.size(1334, 750)
				cc.director.getScene().children[0].getComponent(cc.Canvas).fitHeight = true
				cc.director.getScene().children[0].getComponent(cc.Canvas).fitWidth = false
				jsb.reflection.callStaticMethod("AppController", "changeOrientationH:", "", 1);
			}
		} else {
			cc.view.setOrientation(cc.macro.ORIENTATION_LANDSCAPE)
			cc.director.getScene().children[0].getComponent(cc.Canvas).designResolution = cc.size(1334, 750)
			cc.director.getScene().children[0].getComponent(cc.Canvas).fitHeight = true
			cc.director.getScene().children[0].getComponent(cc.Canvas).fitWidth = false
		}
	}
	public static changeCanvasToVertical() {
		if (cc.sys.isNative) {
			if (cc.sys.os == cc.sys.OS_ANDROID) {
				jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "changeOrientationH", "(I)V", 0);
				cc.view.setOrientation(cc.macro.ORIENTATION_PORTRAIT)
				cc.director.getScene().children[0].getComponent(cc.Canvas).designResolution = cc.size(750, 1334);
				cc.director.getScene().children[0].getComponent(cc.Canvas).fitHeight = false;
				cc.director.getScene().children[0].getComponent(cc.Canvas).fitWidth = true;
			}
			if (cc.sys.os == cc.sys.OS_IOS) {
				cc.view.setOrientation(cc.macro.ORIENTATION_PORTRAIT)
				cc.director.getScene().children[0].getComponent(cc.Canvas).designResolution = cc.size(750, 1334);
				cc.director.getScene().children[0].getComponent(cc.Canvas).fitHeight = false;
				cc.director.getScene().children[0].getComponent(cc.Canvas).fitWidth = true;
				jsb.reflection.callStaticMethod("AppController", "changeOrientationH:", "", 0);
			}
		} else {
			cc.view.setOrientation(cc.macro.ORIENTATION_PORTRAIT)
			cc.director.getScene().children[0].getComponent(cc.Canvas).designResolution = cc.size(750, 1334);
			cc.director.getScene().children[0].getComponent(cc.Canvas).fitHeight = false;
			cc.director.getScene().children[0].getComponent(cc.Canvas).fitWidth = true;
		}
	}
}